/**
 * 探针相关
 * @type {{promotionBIProbe: Window.$Probe.promotionBIProbe, orderResultBIProbe: Window.$Probe.orderResultBIProbe}}
 */
window.$Probe = {
    jumpCode:"",//页面离开和进入对应的uuid
    aCollectActive:[],//收藏动作,如果有多个一起处理时
    context:{},//探针用的页面上下文
    linkPoint:{},//页面离开时的跳转
    aJump : ['$URL.forward','$URL.forward2Subject','$URL.backAPage','$URL.forwardForget'],
    filterAwayProbe:function(args){ 
        this.jumpCode=$Utility.uuid(32,16);
        $Cookie.set('jumpCode',this.jumpCode);
        if(args=='$URL.backAPage'){//backAPage
            $Probe.leaveBIProbe('back');
        }
        $Probe.UILeave();//页面离开探针,这里有问题todo:
    },
    updateActive:function (){//更新active,每次动作更新lastActiveTime
        var iCurrentTime=new Date().getTime();
        if(iCurrentTime-this.lastActiveTime>=20*60*1000){//超过20分钟时
            $Cookie.set('lastActiveTime',iCurrentTime);//更新lastActiveTime时间
            $Cookie.set('uuid',$Utility.uuid(32,16));//更新uuid
            this.sessionId=$Cookie.get('uuid');
        }
    },
    leaveBIProbe:function(strType,strId,strCode){
        this.linkPoint.type=strType; 
        if(strId){
            if(strType=='button'){
                this.linkPoint.name=""+strId;
            }else{
                this.linkPoint.id=parseInt(strId);
            }
        }
        if(strCode){
            this.linkPoint.code=""+strCode;
        }
        if(strType=='media'){
            this.linkPoint.appId=this.appId;//补充节目的所属的appId
        }
    },
    assignOpts:function(target,target2,source){
        var bGoto=true;
        if($Utility.checkType(source,'Object')){
            for(var item in target){//更新必要的值
                
                //if(source[item]||!isNaN(source[item])){
                    target[item]=source[item];
                // }else{
                //     $Log.error('探针:'+item +'--参数缺少');
                //     bGoto=false;
                // }
                if(target[item] == undefined){
                    target[item] = "undefined";//如果没定义也要提示一下没定义
                }
            }
            target=$Utility.assign(target,target2);
        }else{
            bGoto=false;
        }
        if(bGoto){
            return target;
        }else{
            $Log.error(target['action']+' probe error');
        }
    },
    Login:function(oArg){
        var that=this;
        this.sessionId=$Cookie.get('uuid') || $Utility.uuid(32,16);
        $Cookie.set('uuid',this.sessionId);
        var oSolidParam={
            "action":'Login'
        }
        var oParam=this.getOpts('Login');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    UIEnter:function(){
        var that=this;
        this.lastActiveTime=$Cookie.get('lastActiveTime') || 0;
        this.updateActive();
        this.sessionId=$Cookie.get('uuid') || $Utility.uuid(32,16);
        $Cookie.set('lastActiveTime',this.lastActiveTime);
        $Cookie.set('uuid',this.sessionId);
        $Utility.intercept('before')(that.aJump,[that.filterAwayProbe]);//探针的拦截器
        var oParam={
            "parameters":$URL.getParameterFromURL('referURL'),
            "action":"UIEnter",
            "jumpCode":$Cookie.get('jumpCode') ? ($Cookie.get('jumpCode')!=null? $Cookie.get('jumpCode'):'-') : '-'
        }
        $Cookie.del('jumpCode');//页面进入删除jumpCode 有必要?
        this.requestProbe(oParam);

    },
    UILeave:function(oArg){
        oArg = oArg || {};
        if(!oArg.module){
            oArg.module = $Dom.getById($Focus.strFocusElementId).getAttribute("module") || $Focus.strFocusElementId ;
        }
        var that=this;
        if(!this.linkPoint.type){//没有写type,都默认是other
            this.linkPoint.type='other';
        }
        var oSolidParam={
            "action":"UILeave",
            "jumpCode":that.jumpCode,//页面离开进来jumpcode对应
            "linkPoint":that.linkPoint,
            "parameters":$URL.getParameterFromURL('referURL'),
            "context":JSON.parse(JSON.stringify(that.context)),
        }
        var oParam=this.getOpts('UILeave');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    UIActive:function(oArg){//页面交互,备用补充,例如:拦截弹框的统计
        var that=this;
        var oSolidParam={
            "actionTime":that.lastActiveTime,
            "context":JSON.parse(JSON.stringify(that.context)),
        }
        var oParam=this.getOpts('interActive');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    Subscribing:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"Subscribing",
            "context":JSON.parse(JSON.stringify(that.context)),
        }
        var oParam=this.getOpts('Subscribing');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    Subscribed:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"Subscribed",
            "context":JSON.parse(JSON.stringify(that.context)),
        }
        var oParam=this.getOpts('Subscribed');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    Auth:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"Auth",
            "context":JSON.parse(JSON.stringify(that.context)),
        }
        var oParam=this.getOpts('Auth');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    Unsubscribing:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"Unsubscribing",
        };
        var oParam=this.getOpts('Unsubscribing');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    Unsubscribed:function(oArg,bIsGo){
        var that=this;
        var oSolidParam={
            "action":"Unsubscribed",
        }
        var oParam=this.getOpts('Unsubscribed');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg),bIsGo);
    },
    MediaUncollect:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaUncollect",
        }
        var oParam=this.getOpts('MediaCollect');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaCollect:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaCollect",
        }
        var oParam=this.getOpts('MediaCollect');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaClearCollect:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaClearCollect",
        }
        var oParam=this.getOpts('MediaCollect');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaSearch:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaSearch",
        }
        var oParam=this.getOpts('MediaSearch');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaSearchAccept:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaSearchAccept",
        }
        var oParam=this.getOpts('MediaSearchAccept');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaPlay:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaPlay",
            "actionTime":new Date().getTime()
        }
        var oParam=this.getOpts('MediaPlayStatus');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaPause:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaPause",
            "actionTime":new Date().getTime()
        }
        var oParam=this.getOpts('MediaPlayStatus');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaStop:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaStop",
            "actionTime":new Date().getTime()
        }
        var oParam=this.getOpts('MediaPlayStatus');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaSeek:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaSeek",
            "actionTime":new Date().getTime()
        }
        var oParam=this.getOpts('MediaSeek');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    MediaPlayAvailable:function(oArg){
        var that=this;
        var oSolidParam={
            "action":"MediaPlayAvailable",
        }
        var oParam=this.getOpts('MediaPlayAvailable');
        this.requestProbe(that.assignOpts(oParam,oSolidParam,oArg));
    },
    requestProbe:function(oParam,bIsGo){
        if(!$Utility.checkType(oParam,'Object')){
            return;
        }
        //通用的探针参数
        oParam.userId=parseInt($Cookie.get("selfUserId")) || -1;
        oParam.platformAccount=$Cookie.get('platformAccount') || "no platform account";
        oParam.product=$Page.appId;
        oParam.version=""+$Config.VERSION;
        oParam.sessionId=this.sessionId;
        oParam.ui = $Page.CURRENT_UI;
        var aAll=[];
        if(-1!=oParam['action'].indexOf('MediaUncollect')){//批量取消收藏
            this.aCollectActive.push(oParam);
            if(bIsGo && this.aCollectActive.length<4){//继续
                return;//还没完成
            }else{
                aAll=this.aCollectActive;
                this.aCollectActive=[];//初始化为空
            }
        }else{
            aAll.push(oParam);//大部分都是这个
        }
        var flag = oParam.action != "UILeave";//如果是切换页面请求变成同步的
        var args='ray='+encodeURIComponent(JSON.stringify(aAll));//数组作为参数值传到ray参数里边
        $Network.ajax('GET',$Circumstance.BI_BASE_PATH,['application/x-www-form-urlencoded'],args,function(responseText){
            $Log.info("probe Business::");
        },function(responseText){
            $Log.error("probe Communication::");
        },{timeout:500},flag);
        return true;	
    },
    getOpts:function(action){
        var oParam={};
        switch(action){
            case "Login":
                var oParam={
                    "productId":"nothing",//鉴权成功的产品Id
                    "from":{}
                }
                break;
            case "UIEnter":
                break;
            case "UILeave":
                oParam={
                    "module":"",
                }
                break;
            case "interActive":
                oParam={
                    "module":"",
                    "action":"",
                }
                break; 
            case "Subscribing":
                oParam={
                    "productId":"",
                    "unitPrice":"",
                    "mediaId":-1,
                    "mediaCode":"",
                    'orderMode':0,//jm1,正常0
                    "transactionId":"",
                }
                break;
            case "Subscribed":
                oParam={
                    "productId":"",
                    "unitPrice":"",
                    "mediaId":-1,
                    'mediaCode':"",
                    'orderMode':0,//jm1,正常0
                    "result":-1,//订购结果 -1失败,0成功
                    "transactionId":"",//返回过来拿到的参数
                }
                break;
            case "Auth":
                var oParam={
                    "productId":"",
                    "result":0,//鉴权结果 0失败,1成功
                    "mediaId":-1,
                    "mediaCode":"",
                }
            case "Unsubscribing":
                var oParam={
                    "productId":"",
                    "transactionId":"",
                }
                break;
            case "Unsubscribed":
                var oParam={
                    "productId":"",
                    "result":-1,//订购结果 -1失败,0成功
                    "transactionId":"",
                }
                break;
            case "MediaCollect":
                var oParam={
                    "mediaId":-1,
                    "mediaCode":"",
                }
                break;
            case "MediaSearch":
                var oParam={
                    "keyword":"",
                    "resultCount":0,//搜索出来的个数
                }
                break;
            case "MediaSearchAccept":
                var oParam={
                    "keyword":"",
                    "type":"",//media/artist/subject
                    "id":-1,//mediaId/artistId/subjectId
                    "code":"",
                }
                break;
            case "MediaPlayStatus":
                var oParam={
                    "mediaId":-1,
                    "mediaCode":"",
                    "position":0,  //当前播放时间
                    "duration":0,
                    "appId":"",
                }
                break;
            case "MediaSeek":
                var oParam={
                    "mediaId":-1,
                    "mediaCode":"",
                    "startTime":0,
                    "endTime":0,
                    "duration":0,
                    "appId":"",
                }
                break;
            case "MediaPlayAvailable":
                var oParam={
                    "mediaId":-1,
                    "mediaCode":"",
                    "appId":""
                }
                    
        }
        return oParam;
    },
    /**
     * 推荐位探针
     * @param strPromotionId
     */
    promotionBIProbe : function (strPromotionId) {
        try {
            var oParams = {};
            var strPlatformAccount = eval('$Cookie.get("platformAccount")');

            oParams.platformAccount = strPlatformAccount;

            //为了BI方便统计，做些变形
            var strBIURL = './NoPage/TopdrawPromotion?id=' + strPromotionId;

            oParams.url = strBIURL;

            ajax('GET', $Circumstance.BI_BASE_PATH_OLD, null, oParams, function (responseText) {
                $Log.info("探针 Business::");
                //eval("forward('personalShow.html?cId=44')");
            }, function (responseText) {
                $Log.info("探针 Communication::");
            });
            $Log.warn($Circumstance.BI_BASE_PATH_OLD );
            $Log.warn( JSON.stringify(oParams));

        } catch (err) {
            $Log.error("BI Probe Request Error..." + err);
        }
    },
    /**
     * 订购结果探针
     * @param strOrderResult
     */
    orderResultBIProbe : function (strOrderResult) {
        try {
            var oParams = {};
            oParams.appId = $Page.appId;
            oParams.orderDescription = strOrderResult;

            //为了BI方便统计，做些变形
            var strBIURL = './NoPage/TopdrawOrderResult';

            oParams.url = strBIURL;

            ajax('GET',$Circumstance.BI_BASE_PATH_OLD, null, oParams, function (responseText) {
                $Log.info("探针 Business::");
                //eval("forward('personalShow.html?cId=44')");
            }, function (responseText) {
                $Log.info("探针 Communication::");
            });
            $Log.warn($Circumstance.BI_BASE_PATH_OLD + oParams);

        } catch (err) {
            $Log.error("BI Probe Request Error..." + err);
        }
    },
    /**
     * 初始化探针
     * 说明
     * 1.onMediaListSuccess 存储已请求节目信息，方便探针请求时发送需要的节目信息
     * 2.
     */
    initProbe : function(){
        
        /**
         * 用来存储接口数据
         * @param {*} oJSONResult 
         * @param {*} strURL 
         */
        $Probe.oMediaInfo = {};
        var onMediaListSuccess = function(oJSONResult,strURL){
            if(strURL&&(-1 != strURL.indexOf("Media/List")||strURL.indexOf("User/ListMediaByCollection"))){
                for(var i = 0; i < oJSONResult.resultSet.length; i++ ){
                    $Probe.oMediaInfo[oJSONResult.resultSet[i].id] = oJSONResult.resultSet[i].code;
                }
                if(strKeyword&&strKeyword!=strPreKeyword){
                    $Probe.MediaSearch({
                        "keyword":strKeyword,
                        "resultCount":oJSONResult.resultSet.length+"",//搜索出来的个数
                    })
                }
                strPreKeyword = strKeyword;
            }

            
            
        }
    
        //是否已完成进入 防止进入探针重复发送
        var bEntered = false;
        //拦截结果的方法
        var fnResultCbs = [onMediaListSuccess];
        //用户搜索采纳
        var strKeyword = "";
        var strPreKeyword = "";
        //拦截页面进入探针
        $Utility.intercept("after")(["$Focus.init"],[function(){
            try{
                if(!bEntered&&$Page.CURRENT_UI){
                    bEntered = true;
                    $Probe.UIEnter();//进入页面的探针
                }
                if($Page.CURRENT_UI == "player"){
                    $Probe.interceptPlayer();
                }
            }catch(error){
                $Log.error("拦截页面进入探针 Error==>"+error);
            }
            
        }]);
        //拦截点击事件
        $Utility.intercept("before")(["$KeyHandler.handleClick"],[function(_, args){
            try{
                var elCurrent = $Dom.getById($Focus.strFocusElementId);
                var strType = elCurrent.getAttribute("promotionType");
                var strId = elCurrent.getAttribute("promotionId");
                var strCode = elCurrent.getAttribute("promotionCode");
                //处理推荐位
                if(strType){
                    $Probe.leaveBIProbe(strType,strId,strCode);
                }
                //处理搜索采纳
                if(strKeyword&&elCurrent.getAttribute("module") == "media_list"){
                    var strTVLink = elCurrent.getAttribute("tvlink");
                    var oTVLink = JSON.parse(strTVLink);
                    var strMediaId = "";
                    for(var i = 0; i < oTVLink.click.length; i++){
                        if(oTVLink.click[i].parameters){
                            strMediaId = oTVLink.click[i].parameters.mediaId || "";
                        }
                    }
                    $Probe.MediaSearchAccept({
                        "keyword":strKeyword,
                        "type":"media",//media/artist/subject
                        "id":strMediaId,//mediaId/artistId/subjectId
                        "code":$Probe.oMediaInfo[strMediaId],
                    });
                }
            }catch(error){
                $Log.error("拦截点击事件 Error==>"+error);
            }
            
        }]);
        //拦截ajax结果 一般用来储存节目信息，方便发送探针时提取，比如存储节目信息
        $Utility.intercept("before")(["$Network.onRequestSuccess"],[function(_,responseText){
            try{
                if(-1!=responseText[2].indexOf($Circumstance.TOPDRAW_API_SERVER_PLAY) || -1!=responseText[2].indexOf($Circumstance.TOPDRAW_API_SERVER)){
                    var oJSONResult = JSON.parse(responseText[0]);
                    for(var i = 0; i < fnResultCbs.length; i++){
                        fnResultCbs[i]&&fnResultCbs[i](oJSONResult,responseText[2]);
                    }
                }
               
            }catch(error){
                $Log.error("拦截ajax结果 Error==>"+error);
            }
            
        }]);
        //拦截ajax 用于收藏 删除收藏 批量删除收藏 搜索结果
        $Utility.intercept("before")(["$Network.ajax","$Network.get","$Network.post"],[function(strFnName, args){
            try{
                var reg =  $Circumstance.TOPDRAW_API_SERVER_PLAY;
                var strURL = strFnName == "$Network.ajax" ? args[1] : args[0];
                if(-1 == strURL.indexOf('Platform')){
                    reg = $Circumstance.TOPDRAW_API_SERVER;
                }
                var aURL = strURL.split("?"); 
                var strAPI = aURL[0].replace(reg,"");
                var aInterceptAPI = ["User/RemoveMediaFromCollection","User/RemoveAllMediaFromCollection","User/AddMedia2Collection","Media/List"];
                if(-1 != aInterceptAPI.indexOf(strAPI)){
                    var oParams = null;
                    if(aURL[1]){
                        oParams = {};
                        oParams = $URL.strParams2Object(aURL[1]);
                    }
                    var oData = strFnName == "$Network.ajax" ? args[3] : args[2];
                    if(typeof oData == "string"){
                        oData = $URL.strParams2Object(oData);
                    }

                    if(oParams){
                        for(var key in oParams){
                            oData[key] = oParams[key];
                        }
                    }
                    
                    var strType = "";
                    var strContent = "";
                    switch(strAPI){
                        case "User/RemoveMediaFromCollection":
                            $Probe.MediaUncollect({
                                "mediaId":oData.mediaId || oData.mediaIds,
                                "mediaCode":$Probe.oMediaInfo[oData.mediaId || oData.mediaIds]
                            });
                            break;
                        case "User/RemoveAllMediaFromCollection":
                            $Probe.MediaClearCollect({
                                "mediaId":-1,
                                "mediaCode":$Probe.oMediaInfo[oData.mediaId || oData.mediaIds]
                            });
                            break;
                        case "User/AddMedia2Collection":
                            $Probe.MediaCollect({
                                "mediaId":oData.mediaId || oData.mediaIds,
                                "mediaCode":$Probe.oMediaInfo[oData.mediaId || oData.mediaIds]
                            });
                            break;
                        case "Media/List":
                            strKeyword = oData.keyword;
                            break;
                    }
                }
                
            }catch(error){
                $Log.error("拦截ajax Error==>"+error);
            }
            
        }]);
       
        
        
    },
    /**
     * 拦截播放器相关操作
     */
    interceptPlayer : function(){
        /**
         * 拦截播放器相关
         */
        var bValidPlayProbe = false;
        var iPlayStartTime = 0;
        var iProgramDuration = 0;
        var iStepStarttedTime = 0;
        var iRealPlayingTime = 0;//真实播放时长
        var iCurrentPlayerTime = 0;
        $Utility.intercept("before")(["$Page.mediaPlayer.updateCb"],[function(_,args){
            try{
                if($Page.mediaPlayer.playing()&&!$Page.mediaPlayer.stepping()){
                    iRealPlayingTime++;
                }
                iCurrentPlayerTime = $Page.mediaPlayer.getCurrent();
                //有效播放时长的判断探针 这里的判断条件似乎有点问题
                var iPlayedTime = $Page.mediaPlayer.getCurrent() - iPlayStartTime;
                if(!bValidPlayProbe && ((iProgramDuration > 5*60*60 && iPlayedTime > iProgramDuration*0.5&& iRealPlayingTime > iProgramDuration*0.5 ) || (iProgramDuration<5*60*60&&iPlayedTime > iProgramDuration*0.9&&iRealPlayingTime > iProgramDuration*0.9))){//总时长超过5分钟与否
                    $Probe.MediaPlayAvailable({
                        "mediaId":$Page.strMediaId,
                        "mediaCode":$Probe.oMediaInfo[$Page.strMediaId],
                        "appId":$Page.appId
                    });
                    bValidPlayProbe=true;
                }
            }catch(error){
                $Log.error("Page.mediaPlayer.updateCb Error==>"+error);
            }
            
        }]);
        $Utility.intercept("before")(["$Page.mediaPlayer.onReady2Play"],[function(_,args){
            try{
                bValidPlayProbe = false;
                iProgramDuration = $Page.mediaPlayer.getDuration();
                iPlayStartTime = $Page.mediaPlayer.getCurrent();
                iRealPlayingTime = 0;
                $Probe.MediaPlay({
                    "mediaId":$Page.strMediaId,
                    "mediaCode":$Probe.oMediaInfo[$Page.strMediaId],
                    "position":iPlayStartTime,  //当前播放时间
                    "duration":iProgramDuration,
                    "appId":$Page.appId
                });
            }catch(error){
                $Log.error("Page.mediaPlayer.onReady2Play Error==>"+error);
            }
            
        }]);
        $Utility.intercept("before")(["$Page.mediaPlayer.fnSteppedCb"],[function(_,args){
            try{
                $Probe.MediaSeek({
                    "mediaId":$Page.strMediaId,
                    "mediaCode":$Probe.oMediaInfo[$Page.strMediaId],
                    "startTime":iStepStarttedTime,
                    "endTime":$Page.mediaPlayer.getCurrent(),
                    "duration":$Page.mediaPlayer.getDuration(),
                    "appId":$Page.appId,
                });
            }catch(error){
                $Log.error("Page.mediaPlayer.fnSteppedCb Error==>"+error);
            }
            
        }]);
        $Utility.intercept("before")(["$Page.mediaPlayer.fnStepStartCb"],[function(_,args){
            try{
                iStepStarttedTime =  $Page.mediaPlayer.getCurrent();
            }catch(error){
                $Log.error("Page.mediaPlayer.fnStepStartCb Error==>"+error);
            }
            
        }]);
        $Utility.intercept("before")(["$Page.mediaPlayer.pause"],[function(_,args){
            try{
                $Probe.MediaPause({
                    "mediaId":$Page.strMediaId,
                    "mediaCode":$Probe.oMediaInfo[$Page.strMediaId],
                    "position":iCurrentPlayerTime,  //当前播放时间
                    "duration":iProgramDuration,
                    "appId":$Page.appId
                });
            }catch(error){
                $Log.error("Page.mediaPlayer.pause Error==>"+error);
            }
            
        }]);
        $Utility.intercept("before")(["$Page.mediaPlayer.resume"],[function(_,args){
            try{
                $Probe.MediaPlay({
                    "mediaId":$Page.strMediaId,
                    "mediaCode":$Probe.oMediaInfo[$Page.strMediaId],
                    "position":iCurrentPlayerTime,  //当前播放时间
                    "duration":iProgramDuration,
                    "appId":$Page.appId
                });
            }catch(error){
                $Log.error("Page.mediaPlayer.resume Error==>"+error);
            }
            
        }]);
        //播放结束或者销毁播放器
        $Utility.intercept("before")(["$Page.mediaPlayer.onMediaCompleted","$Page.mediaPlayer.destroy"],[function(strFnName,args){
            try{
                $Probe.MediaStop({
                    "mediaId":$Page.strMediaId,
                    "mediaCode":$Probe.oMediaInfo[$Page.strMediaId],
                    "position":iCurrentPlayerTime,  //当前播放时间
                    "duration":iProgramDuration,
                    "appId":$Page.appId
                });
            }catch(error){
                $Log.error( strFnName + " Error==>" + error);
            }
            
        }]);
       
    }
}    
